package com.it.enums.flow;

import lombok.Getter;

/**
 * @author TBH
 * @date 2025-05-09 15:30:27
 * @desc
 */
@Getter
public enum ProcessType {
    PROCESS_START(1, "流程开始"),
    UNDER_APPROVAL(2, "审批中"),
    PROCESS_FINISH(3, "审批完成");

    private final int code;
    private final String progress;

    ProcessType(int code, String progress) {
        this.code = code;
        this.progress = progress;
    }

    public static ProcessType fromCode(int code) {
        for (ProcessType processType : ProcessType.values()) {
            if (processType.code == code) {
                return processType;
            }
        }
        return null;
    }

    public static String getProgress(int code) {
        for (ProcessType processType : ProcessType.values()) {
            if (processType.code == code) {
                return processType.progress;
            }
        }
        return "";
    }
}
